package com.ruoyi.user.controller;

import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
import com.ruoyi.user.Utils.AliyunOssUtil;
import com.ruoyi.user.common.ResultInfo;
import com.ruoyi.user.pojo.Detall;
import com.ruoyi.user.pojo.User;
import com.ruoyi.user.service.UserRegistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.smartcardio.Card;
import java.awt.*;

@RestController
@RequestMapping("register")
public class UserRegisterController {
    @Autowired
    UserRegistService userRegistService;

    /**
     * 用户注册功能
     * @param user
     * @return
     */
    @RequestMapping("registInsert")
    public ResultInfo registInsert(@RequestBody User user){
        ResultInfo resultInfo = userRegistService.insert(user);
        return  resultInfo;
    }


    @PostMapping("image")
    public ResultInfo image(@RequestPart("file") MultipartFile file) {
        AliyunOssUtil oss = AliyunOssUtil.OSS();
        String upload = oss.upload(file);
        User user = new User();
        user.setImage(upload);
        return new ResultInfo(5544, "ssss", user);
    }
}
